<?php 
//error_reporting(0);
$isadmin=1;
include "../../comm/tuaninc.php";
include('../check.php');

$sql="select * from ".$duoduo->BIAOTOU."city order by sortorder desc";
$city_arr=$duoduo->sqltoarr($sql);

if($_GET['act']=='gengxin'){
    $duoduo->make_city(); //生成城市缓存
	admin_log('更新城市缓存');
	$duoduo->alert('更新完成');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<script src="../js/jquery.js"></script> 
<script>
$(function(){
	$("#form1 tr td:not('.cityid')").dblclick(function(){
	    var inval = $(this).html();
	    var infd = $(this).attr("class");
	    var inid =  $(this).parents('tr').attr("id");
	    $(this).html("<input onblur='gengxin($(this))' id='edit"+infd+inid+"' infd='"+infd+"' inid='"+inid+"' value='"+inval+"'> ");
	});
	
	$('.isshow select').change(function(){
	    var inval = $(this).val();
	    var infd = $(this).attr("class");
	    var inid =  $(this).parents('tr').attr("id");
		$.post("ajax.php",{fun:'gengxin',cityid:inid,field:infd,val:inval});
	});
});

function gengxin(t){
    var obj=t;
	inid=obj.attr('inid');
	infd=obj.attr('infd');
	var editval = obj.val();
    $('#'+inid+' .'+infd).html(editval);
    $.post("ajax.php",{'fun':'gengxin','cityid':inid,'field':infd,'val':editval});
}
</script>
<style type="text/css">
<!--
table,tr,td { font-size:12px;}
table a { text-decoration:none; color:#FF6600}
table a:visted { color:#FF66CC; text-decoration:none}
.STYLE1 {color: #FF6600}
form td{ text-align:center}
.dan{ background:#E9F2FB}  
form td{ font:normal 12px/17px Arial;padding:2px;width:100px; text-align:center}
form th{ font:bold 12px/17px Arial;padding:4px;border-bottom:1px solid #333;}
form td.cityid{ width:30px}
-->
</style>
</head>
<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" >
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td height="30" colspan="2" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" /> 团购城市设置</strong>&nbsp;&nbsp;<a style="color:#F30" href="tuan_city_set.php?act=gengxin">更新城市缓存</a></td>
            </tr>
            <tr>
              <td width="100%" colspan="2" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top" style=" padding-top:5px"><form id="form1" name="form1" method="post" action="">
                    <table width="98%"  align="center" border=1 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor="#dddddd">
                    <tr><th>ID</th><th>城市</th><th>排序</th><th>拼音</th><th>首字母</th><th>显示/隐藏</th></tr>
					  <?php $n=0; foreach($city_arr as $k=>$v){?>
                      <tr <?php if($n%2==0){?> class="dan"<?php }?> id="<?=$v['cityid']?>">
                        <td class='cityid' height="30"><?=$v['cityid']?></td>
                        <td class='cityname'><?=$v['cityname']?></td>
                        <td class='sortorder'><?=$v['sortorder']?></td>
                        <td class='pinyin'><?=$v['pinyin']?></td>
                        <td class='first_word'><?=$v['first_word']?></td>
                        <td class='isshow'><select class="isshow"><option <?php if($v['isshow']==1){?> selected="selected"<?php }?> value="1">显示</option><option <?php if($v['isshow']==0){?> selected="selected"<?php }?> value="0">隐藏</option></select></td>
                      </tr>
                      <?php $n++; }?>
                      
                    </table>
                    <br />
                  </form>
                  </td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</div>
</body>
</html>
